import React, {Component} from "react";
import {HashRouter as Router,Link} from "react-router-dom";
import "./myAfterLogin.css"

var phoneNum='';

export default class MyAfterLogin extends Component{
    constructor(props){
        super(props);
        phoneNum=document.cookie.split(';')[0].split('=')[1];
        if(phoneNum=='null'||phoneNum==''){
            alert('您还没有登录');
            window.location.href = '#/terran/meNotLogin';
            return;
        }
    }

    render() {
        return (
            <div className="myAfterLogin">
                <div className="alr-header">
                    <a className='alr-setting'>设置</a>
                </div>
                <div className="alr-user-info">
                    <img src={[require("./img/用户.jpg")]}/>
                    <div className="alr-info">
                        <h4>我的用户名</h4>
                        <span>{phoneNum}</span>
                    </div>
                    <div className="alr-pos-right"><div className="alr-right-arrow"></div></div>
                </div>
                <div className="alr-detail">
                    <ul>
                        <li>
                            <p className="alr-num">12</p>
                            <p className="alr-mark">动态</p>
                        </li>
                        <li>
                            <p className="alr-num">12</p>
                            <p className="alr-mark">关注</p>
                        </li>
                        <li>
                            <p className="alr-num">2</p>
                            <p className="alr-mark">粉丝</p>
                        </li>
                    </ul>
                </div>
                <div className="alr-content">

                    <div className="alr-my-item" onClick={()=>window.location.href = '#/terran/myAsset'}>
                        <img className="alr-my-icon" src={[require("./img/资产.png")]} alt=""/>
                        <span>我的资产</span>
                        <div className="alr-pos-right"><div className="alr-right-arrow"></div></div>
                    </div>
                    <div className="alr-my-item">
                        <img className="alr-my-icon" src={[require("./img/自选.png")]} alt=""/>
                        <span>我的自选</span>
                        <div className="alr-pos-right"><div className="alr-right-arrow"></div></div>
                    </div>
                    <div className="alr-my-item" onClick={()=>window.location.href = '#/terran/mySimulation'}>
                        <img className="alr-my-icon" src={[require("./img/模拟.png")]} alt=""/>
                        <span>我的模拟</span>
                        <div className="alr-pos-right"><div className="alr-right-arrow"></div></div>
                    </div>
                    <div className="alr-my-item" onClick={()=>window.location.href = '#/terran/myAccount'}>
                        <img className="alr-my-icon" src={[require("./img/收藏.png")]} alt=""/>
                        <span>我的账户</span>
                        <div className="alr-pos-right"><div className="alr-right-arrow"></div></div>
                    </div>
                    <div className="alr-my-item" onClick={()=>window.location.href = '#/terran/helpCenter'}>
                        <img className="alr-my-icon" src={[require("./img/客服.png")]} alt=""/>
                        <span>我的客服</span>
                        <div className="alr-pos-right"><div className="alr-right-arrow"></div></div>
                    </div>
                </div>
                <Router>
                    <Link to="/terran/my">
                        <button className="alr-sign-out-btn" onClick={()=>{document.cookie="phoneNum=null";}} >退出登录</button>
                    </Link>
                </Router>
            </div>
        );
    }

}
